/**
 *  学习目标：Todos 案例
 */
import React from 'react'
export default class App extends React.Component {
  state = {
    count: 1
  }
  render() {
    return (
      <>
        <h4>{this.state.count}</h4>
        <button onClick={this.btnFn}>点击</button>
        <br />
        <button onClick={this.btn1}>原</button><br />
        <button onClick={this.btn2}>新</button>
      </>
    )
  }
  btnFn = () => {
    this.setState(() => {
      return { count: this.state.count + 1 }
    }, () => {
      console.log(this.state.count);
    })
  }
  btn1 = () => {
    this.setState({
      count: this.state.count + 1
    })
    this.setState({
      count: this.state.count + 2
    })
    this.setState({
      count: this.state.count + 3
    })
    console.log(this.state.count);
  }
  btn2 = () => {
    this.setState(() => {
      return { count: this.state.count + 1 }
    }, () => {
      console.log(this.state.count);
    })
    this.setState(() => ({ count: this.state.count + 2 }))
  }
}


